package model_Ke;

import java.util.ArrayList;
import java.util.List;

public class FreeTree extends UndirectedGraph {

	public FreeTree(int[][] matrix, List<Point> numberPoints) {
		super(matrix, numberPoints);
	}

	public FreeTree(MatrixWeight matrixWeight, List<Point> numberPoints) {
		super(matrixWeight, numberPoints);
	}

	public int dolechtam(int a) {
		int max = 0;
		for (int i = 0; i < size(); i++) {
			// System.out.println("a:" + a + ", i: " + i);
			// System.out.println(toString());
			int temp = numberWay(a, i);
			// System.out.println("Temp: " + temp);
			if (max < temp) {
				max = temp;
			}
		}
		return max;
	}

	public List<Integer> mathEccentricity() {
		List<Integer> result = new ArrayList<Integer>();
		int a[] = new int[size()];
		double bk = Double.POSITIVE_INFINITY;
		for (int i = 0; i < size(); i++) {
			a[i] = dolechtam(i);
			if (bk > dolechtam(i)) {
				bk = dolechtam(i);
			}
		}
		for (int i = 0; i < a.length; i++) {
			// System.out.println(a[i]);
			if (a[i] == bk) {
				result.add(i);
			}
		}
		// System.out.println("bk: " + bk);
		return result;
	}

}
